package com.tansun.easycare.rule.globalsearch.entity;

import org.drools.core.util.StringUtils;

import com.tansun.easycare.rule.common.entity.RuleBaseEntity;

/**
 * 全局搜索实体Entity
 *
 * @author zhaojunxian
 * @date 2019-11-18
 */
public class RuleGlobalSearch extends RuleBaseEntity<RuleGlobalSearch> {
    private static final long serialVersionUID = 1L;
    private String ruleName;        // 规则名称
    private String modelType;        // 规则类型
    private String className;        // 类名
    private String rrdNameCn;        // 被引用的变量中文名
    private String rrdNameEn;        // 被引用的变量英文名
    private String manageName;        //规则名   
    private String dataSetName;        // 数据集名称
    private String dataParamsNameEn;        // 变量中文名
    private String dataParamsNameCn;        // 变量英文名
    private String projectName;//项目名
    private String projectCode;//项目编码
    
    private String searchType;//前端选择的查询类型，byParams变量，byRule规则，byModel模型
    private Boolean ruleCheckbox;//前端选择的查询类型，规则复选框
    private Boolean deriveVariablesCheckbox;//前端选择的查询类型，衍生变量复选框
    private Boolean modelCheckbox;//前端选择的查询类型，模型复选框
    private Boolean decisionFlowCheckbox;//前端选择的查询类型，决策流复选框
    private String stype;//查询类型
    
	public String getRuleName() {
		return ruleName;
	}
	public void setRuleName(String ruleName) {
		this.ruleName = ruleName;
	}
	public String getModelType() {
		return modelType;
	}
	public void setModelType(String modelType) {
		this.modelType = modelType;
	}
	public String getClassName() {
		return className;
	}
	public void setClassName(String className) {
		this.className = className;
	}
	public String getRrdNameCn() {
		return rrdNameCn;
	}
	public void setRrdNameCn(String rrdNameCn) {
		this.rrdNameCn = rrdNameCn;
	}
	public String getRrdNameEn() {
		return rrdNameEn;
	}
	public void setRrdNameEn(String rrdNameEn) {
		this.rrdNameEn = rrdNameEn;
	}
	public String getManageName() {
		return manageName;
	}
	public void setManageName(String manageName) {
		this.manageName = manageName;
	}
	public String getDataSetName() {
		return dataSetName;
	}
	public void setDataSetName(String dataSetName) {
		this.dataSetName = dataSetName;
	}
	
	public String getDataParamsNameEn() {
		return dataParamsNameEn;
	}
	public void setDataParamsNameEn(String dataParamsNameEn) {
		this.dataParamsNameEn = dataParamsNameEn;
	}
	public String getDataParamsNameCn() {
		return dataParamsNameCn;
	}
	public void setDataParamsNameCn(String dataParamsNameCn) {
		this.dataParamsNameCn = dataParamsNameCn;
	}
	public String getProjectName() {
		return projectName;
	}
	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}
	public String getSearchType() {
		return searchType;
	}
	public void setSearchType(String searchType) {
		this.searchType = searchType;
	}
	public String getProjectCode() {
		return projectCode;
	}
	public void setProjectCode(String projectCode) {
		this.projectCode = projectCode;
	}
	public Boolean getRuleCheckbox() {
		return ruleCheckbox;
	}
	public void setRuleCheckbox(Boolean ruleCheckbox) {
		this.ruleCheckbox = ruleCheckbox;
	}
	public Boolean getDeriveVariablesCheckbox() {
		return deriveVariablesCheckbox;
	}
	public void setDeriveVariablesCheckbox(Boolean deriveVariablesCheckbox) {
		this.deriveVariablesCheckbox = deriveVariablesCheckbox;
	}
	public Boolean getModelCheckbox() {
		return modelCheckbox;
	}
	public void setModelCheckbox(Boolean modelCheckbox) {
		this.modelCheckbox = modelCheckbox;
	}
	public Boolean getDecisionFlowCheckbox() {
		return decisionFlowCheckbox;
	}
	public void setDecisionFlowCheckbox(Boolean decisionFlowCheckbox) {
		this.decisionFlowCheckbox = decisionFlowCheckbox;
	}
	public String getStype() {
		if(StringUtils.isEmpty(stype)) {
			if("byParams".equals(searchType)) {
				stype=	"00"+
						(ruleCheckbox!=null&&ruleCheckbox?"1":"0")+
						(deriveVariablesCheckbox!=null&&deriveVariablesCheckbox?"1":"0")+
						(modelCheckbox!=null&&modelCheckbox?"1":"0")+
						(decisionFlowCheckbox!=null&&decisionFlowCheckbox?"1":"0");
			}else if("byRule".equals(searchType)) {
				stype="0100"+
						(modelCheckbox!=null&&modelCheckbox?"1":"0")+
						(decisionFlowCheckbox!=null&&decisionFlowCheckbox?"1":"0");
			}else if("byModel".equals(searchType)) {
				stype="1000"+ 
						(modelCheckbox!=null&&modelCheckbox?"1":"0")+
						(decisionFlowCheckbox!=null&&decisionFlowCheckbox?"1":"0");
			}
		}
		System.out.println(stype);
		return stype;
	}
	public void setStype(String stype) {
		this.stype = stype;
	}
    

}